#include <stdio.h>

__attribute__((constructor)) void foo()  
{  
    printf("in constructor of foo\n");  
}  
__attribute__((constructor)) void foo1()  
{  
    printf("in constructor of foo1\n");  
}  
__attribute__((destructor)) void bar()  
{  
    printf("in destructor of bar\n");  
}  

class Line
{
   public:
      void setLength( double len );
      double getLength( void );
      Line();
      ~Line();
 
   private:
      double length;
};
 
Line::Line(void)
{
    printf("Object is being created\n");
}
Line::~Line(void)
{
    printf("Object is being deleted\n");
}
 
void Line::setLength( double len )
{
    length = len;
}
 
double Line::getLength( void )
{
    return length;
}

int main(int argc, char *argv[])
{
	int* ptr = new int;
	int* ptr2 = new int(1);
	int* arr = new int[10];

    *ptr = 1;
    *ptr2 = 2;
    arr[0] = 1;
    arr[1] = 2;
    
	delete ptr;
	delete ptr2;

	delete[] arr;

    printf("hello, cpp!\n");

    Line line;
    
    line.setLength(6.0); 
    printf("Length of line : %f\n", line.getLength());
    
    return 0;
}
